home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98a.txt / 000135_icon-group-sender _Mon Mar 16 08:02:43 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  4KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.7/8.8.7) with SMTP id IAA19545
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 16 Mar 1998 08:02:42 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA18571; Mon, 16 Mar 1998 08:02:42 -0700
  7. Message-Id: <199803151331.GAA18413@orpheus.gemini.edu>
  8. From: swampler@noao.edu (Steve Wampler)
  9. Date: Sun, 15 Mar 1998 06:31:19 MST
  10. In-Reply-To: Mark Evans's mail message of Mar 13,  4:06pm.
  11. X-Mailer: Mail User's Shell (7.2.3 5/22/91)
  12. To: icon-group@optima.CS.Arizona.EDU
  13. Subject: Re: Letter Probabilities
  14. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  15. Status: RO
  16. Content-Length: 2816
  17.  
  18. On Mar 13 at  4:06pm, Mark Evans writes:
  19. } To the group -
  20. } The probability table is simply a requirement for output.  As long as
  21. } I'm going to compute it anyway, it's useful.  When you generate 'random'
  22. } text without computing it, there is no way to tell from the output what
  23. } are relative probabilities except by very, very gross estimation.  The
  24. } table tells you in a glance, top to bottom.
  25.  
  26. The table may be useful for seeing the relative probabilities, which is
  27. useful for checking for anomolies.  (If you produced 'random' text based
  28. on the novel "Gadsby" for example, the table would help explain the
  29. strange output you'd get.)
  30.  
  31. It is not all that useful in actually generating the 'random' text,
  32. however - the problem becomes much harder when using it!  (See the
  33. aside below)
  34.  
  35. Why not generate the table as an aside and keep the 'random' text
  36. generation simple?  If you think about it, the 'generated string'
  37. solutions that are proposed work on the *same* principle as you
  38. want to use with your table, but without having to convert the
  39. information embedded in the input stream into numeric values and
  40. then back again and without having to convert probability values
  41. into unique numeric ranges.
  42.  
  43. (As an aside, if the table really contains the 'relative probabilities'
  44. of the characters then it is *very* hard to use it to produce the
  45. 'random' output text correctly!  The table has to contain not the
  46. relative probability, but a unique numeric range whose proportion to
  47. the total range matches the relative probability.  So, 'at a glance',
  48. it would not show the relative probability anyway.)
  49.  
  50. } Actually my little program has grown into a moderately complicated Icon
  51. } case study.  I've bumped against the 32K limit, that's for sure.  It has
  52. } buttons, menus, all kinds of things going on.
  53.  
  54. 32K limit?  This is news to me - what version of Icon and what platform
  55. are you using?  I'm sure you can bump that *way* up with most machines
  56. these days!
  57.  
  58. } No one has really answered my original question about the inner while
  59. } loop.  Whether it is ideal for this problem or not, I would like to know
  60. } whether Icon has some elegant mechanism for scanning such an ordered
  61. } list.
  62.  
  63. I've lost your original message and so can't be specific, but here's
  64. an approach to a similar problem:
  65.  
  66. Let 'a' be an ordered list of floating point values, high to low, between
  67. 0.0 and 1.0.
  68.  
  69. Let 'x' be a value between 0.0 and 1.0.
  70.  
  71. The following code assigns to i the index of the first value in 'a' that
  72. is <= 'x':
  73.  
  74.     x > a[i := seq()]
  75.  
  76. Again, note that this (and any similar approach) does not do what you
  77. want if the values in 'a' are relative probabilities.
  78.  
  79. -- 
  80. Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)]
  81. The gods that smiled at your birth are now laughing openly. (Fortune Cookie)
  82.